﻿using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using PioneerBoilerplate.Model.Audits;
using PioneerBoilerplate.Util.Auth;
using System;

namespace PioneerBoilerplate.Repository
{
    public class AuditContext : DbContext
    {
        public readonly IUser _user;
        public readonly IServiceProvider _serviceProvider;
        private readonly string _connectionString;

        public AuditContext(string connectionString= "Server=.;Database=PioneerBoilerplateDb;Trusted_Connection=True;MultipleActiveResultSets=true")
        {
            _connectionString = connectionString;
        }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
            => optionsBuilder.UseSqlServer(_connectionString);

        public DbSet<SaveChangesAuditEntity> SaveChangesAudits { get; set; }
        public DbSet<AuditEntity> Audits { get; set; }
    }
}
